<?php

namespace App\Http\Controllers\Admin;

use App\Http\Servers\Admin\ClearServer;
use App\Http\Servers\Admin\ImageServer;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class ClearController extends CommonController
{
    //清除数据
    public function clear(Request $request, ClearServer $clearServer)
    {
        if (!empty($request->do)) {
            switch ($request->do) {
                case 'delimage':
                    $message['clear'] = $clearServer->delImage();
                    return back()->with($message);
                    break;
                case 'delfile':
                    $message['clear'] = $clearServer->delFile();
                    return back()->with($message);
                    break;
                case 'trash':
                    $message['clear'] = $clearServer->delTrash();
                    return back()->with($message);
                    break;
                case 'fill':
                    $message['clear'] = $clearServer->delFill();
                    return back()->with($message);
                    break;
                case 'message':
                    $message['message'] = $clearServer->delMessage();
                    return back()->with($message);
                    break;
            }
        }

        return view('admin.clear.clear');
    }

    //设置debug操作
    public function debug(Request $request, ClearServer $clearServer)
    {
        if (!empty($request->do)) {
            switch ($request->do) {
                case 'debug':
                    $message['clear'] = $clearServer->setDebug();
                    return back()->with($message);
                    break;
            }
        }
    }


}
